****************************
* Replicate Survey Experiment
****************************

use survey_data.dta

*** TABLE 4 ***

logit selected i.c_dummy##i.f_dummy c.psm_s01 i.od i.brain c.age i.female if type == 1 , vce(cluster id)
est store m1

logit selected i.c_dummy##i.f_dummy c.risk_beruf_r i.od i.brain c.age i.female if type == 1 , vce(cluster id)
est store m2

logit selected i.c_dummy##i.f_dummy c.psm_s01 c.risk_beruf_r i.od i.brain c.age i.female if type == 1 , vce(cluster id)
est store m3

logit selected i.c_dummy##i.f_dummy c.psm_s01 i.od i.brain c.age i.female if type == 2 , vce(cluster id)
est store m4

logit selected i.c_dummy##i.f_dummy c.risk_beruf_r i.od i.brain c.age i.female if type == 2 , vce(cluster id)
est store m5

logit selected i.c_dummy##i.f_dummy c.psm_s01 c.risk_beruf_r i.od i.brain c.age i.female if type == 2 , vce(cluster id)
est store m6

esttab m1 m2 m3 m4 m5 m6, se(2) brackets star(* 0.10 ** 0.05 *** 0.01) scalar(ll) aic bic compress nogaps replace label  nobaselevels 
esttab m1 m2 m3 m4 m5 m6 using reg_tab_survey.rtf, se(2) brackets star(* 0.10 ** 0.05 *** 0.01) scalar(ll) aic bic compress nogaps replace label  nobaselevels 
esttab m1 m2 m3 m4 m5 m6 using reg_tab_survey.csv, se(2) brackets star(* 0.10 ** 0.05 *** 0.01) scalar(ll) aic bic compress nogaps replace label  nobaselevels 
esttab m1 m2 m3 m4 m5 m6 using reg_tab_survey.tex, se(2) brackets star(* 0.10 ** 0.05 *** 0.01) scalar(ll) aic bic compress nogaps replace label  nobaselevels 

* Predictions for plots *

est restore m3
margins c_dummy#f_dummy, saving("survey_pred_inspector.dta", replace)

est restore m6
margins c_dummy#f_dummy, saving("survey_pred_inspectee.dta", replace)

est restore m3
margins, at(psm_s01==(.1(.1)1)) level(90) saving("survey_psm_inspector.dta", replace)

est restore m6
margins, at(psm_s01==(.1(.1)1)) level(90) saving("survey_psm_inspectee.dta", replace)

est restore m3
margins, at(risk_beruf_r==(.1(.1)1)) level(90) saving("survey_risk_inspector.dta", replace)

est restore m6
margins, at(risk_beruf_r==(.1(.1)1)) level(90) saving("survey_risk_inspectee.dta", replace)

*** APPENDIX TABLE 5 ***

logit selected i.c_dummy##i.f_dummy c.psm_f i.od i.brain c.age i.female if type == 1 , vce(cluster id)
est store m1

logit selected i.c_dummy##i.f_dummy c.risk_beruf_r i.od i.brain c.age i.female if type == 1 , vce(cluster id)
est store m2

logit selected i.c_dummy##i.f_dummy c.psm_f c.risk_beruf_r i.od i.brain c.age i.female if type == 1 , vce(cluster id)
est store m3

logit selected i.c_dummy##i.f_dummy c.psm_f i.od i.brain c.age i.female if type == 2 , vce(cluster id)
est store m4

logit selected i.c_dummy##i.f_dummy c.risk_beruf_r i.od i.brain c.age i.female if type == 2 , vce(cluster id)
est store m5

logit selected i.c_dummy##i.f_dummy c.psm_f c.risk_beruf_r i.od i.brain c.age i.female if type == 2 , vce(cluster id)
est store m6

esttab m1 m2 m3 m4 m5 m6, se(2) brackets star(* 0.10 ** 0.05 *** 0.01) scalar(ll) aic bic compress nogaps replace label  nobaselevels 

esttab m1 m2 m3 m4 m5 m6 using reg_tab_survey_rob.rtf, se(2) brackets star(* 0.10 ** 0.05 *** 0.01) scalar(ll) aic bic compress nogaps replace label  nobaselevels 
esttab m1 m2 m3 m4 m5 m6 using reg_tab_survey_rob.csv, se(2) brackets star(* 0.10 ** 0.05 *** 0.01) scalar(ll) aic bic compress nogaps replace label  nobaselevels 
esttab m1 m2 m3 m4 m5 m6 using reg_tab_survey_rob.tex, se(2) brackets star(* 0.10 ** 0.05 *** 0.01) scalar(ll) aic bic compress nogaps replace label  nobaselevels 

*** APPENDIX TABLE 7 ***

logit selected i.c_dummy##i.f_dummy c.app_s i.od i.brain c.age i.female if type == 1 , vce(cluster id)
est store m1

logit selected i.c_dummy##i.f_dummy c.app_s c.risk_beruf_r i.od i.brain c.age i.female if type == 1 , vce(cluster id)
est store m2

logit selected i.c_dummy##i.f_dummy c.app_s i.od i.brain c.age i.female if type == 2 , vce(cluster id)
est store m3

logit selected i.c_dummy##i.f_dummy c.app_s c.risk_beruf_r i.od i.brain c.age i.female if type == 2 , vce(cluster id)
est store m4

esttab m1 m2 m3 m4, se(2) brackets star(* 0.10 ** 0.05 *** 0.01) scalar(ll) aic bic compress nogaps replace label  nobaselevels 

esttab m1 m2 m3 m4 using reg_tab_survey_sub.rtf, se(2) brackets star(* 0.10 ** 0.05 *** 0.01) scalar(ll) aic bic compress nogaps replace label  nobaselevels 
esttab m1 m2 m3 m4 using reg_tab_survey_sub.csv, se(2) brackets star(* 0.10 ** 0.05 *** 0.01) scalar(ll) aic bic compress nogaps replace label  nobaselevels 
esttab m1 m2 m3 m4 using reg_tab_survey_sub.tex, se(2) brackets star(* 0.10 ** 0.05 *** 0.01) scalar(ll) aic bic compress nogaps replace label  nobaselevels 
